package com.xmuexp109.exp5.mapper;

import com.xmuexp109.exp5.model.ordersPo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
@Mapper
public interface ordersPoMapper {

    @Insert("    insert into orders (id, customer_id, shop_id, \n" +
            "      order_sn, pid, consignee, \n" +
            "      region_id, address, mobile, \n" +
            "      message, order_type, freight_price, \n" +
            "      coupon_id, coupon_activity_id, discount_price, \n" +
            "      origin_price, presale_id, groupon_discount, \n" +
            "      rebate_num, confirm_time, shipment_sn, \n" +
            "      state, substate, be_deleted, \n" +
            "      gmt_create, gmt_modified, groupon_id\n" +
            "      )\n" +
            "    values (#{id,jdbcType=BIGINT}, #{customerId,jdbcType=BIGINT}, #{shopId,jdbcType=BIGINT}, \n" +
            "      #{orderSn,jdbcType=VARCHAR}, #{pid,jdbcType=BIGINT}, #{consignee,jdbcType=VARCHAR}, \n" +
            "      #{regionId,jdbcType=BIGINT}, #{address,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, \n" +
            "      #{message,jdbcType=VARCHAR}, #{orderType,jdbcType=TINYINT}, #{freightPrice,jdbcType=BIGINT}, \n" +
            "      #{couponId,jdbcType=BIGINT}, #{couponActivityId,jdbcType=BIGINT}, #{discountPrice,jdbcType=BIGINT}, \n" +
            "      #{originPrice,jdbcType=BIGINT}, #{presaleId,jdbcType=BIGINT}, #{grouponDiscount,jdbcType=BIGINT}, \n" +
            "      #{rebateNum,jdbcType=INTEGER}, #{confirmTime,jdbcType=TIMESTAMP}, #{shipmentSn,jdbcType=VARCHAR}, \n" +
            "      #{state,jdbcType=TINYINT}, #{substate,jdbcType=TINYINT}, #{beDeleted,jdbcType=TINYINT}, \n" +
            "      #{gmtCreate,jdbcType=TIMESTAMP}, #{gmtModified,jdbcType=TIMESTAMP}, #{grouponId,jdbcType=BIGINT}\n" +
            "      )")
    int insertOrders(ordersPo record);
    int insert(ordersPo record);

    @Select("select * from orders where id=#{id}")
    List<ordersPo> findOrders(@Param("id") Long id);
}
